<section class="d-flex">
  <aside style="width: 220px">
    <nz-card>
      <nz-input-group [nzSuffix]="suffixIcon">
        <input type="text" nz-input (keyup)="onKey($event)" placeholder="Search" [(ngModel)]="searchValue" />
      </nz-input-group>
      <ng-template #suffixIcon>
        <i nz-icon nzType="search"></i>
      </ng-template>
      <nz-tree [nzData]="communityList" [nzSearchValue]="searchValue" nzAsyncData (nzClick)="selectChage($event)" (nzExpandChange)="nzEvent($event)" [nzTreeTemplate]="nzTreeTemplate"> </nz-tree>
    </nz-card>
  </aside>
  <div class="flex-1" style="overflow: hidden;">
    <!-- <page-header></page-header> -->
    <app-room-list #room [_param]="{id: activedNode?.key || '', houseName: activedNode?.title, level: activedNode?.origin.rank,parentId: activedNode?.origin.parentId || ''}"></app-room-list>
  </div>
</section>

<ng-template #nzTreeTemplate let-node>
      <span class="custom-node" [class.active]="activedNode?.key === node.key">
        <span *ngIf="!node.isLeaf" (contextmenu)="contextMenu($event, menu, node)">
          <i nz-icon [nzType]="node.isExpanded ? 'folder-open' : 'folder'" (click)="openFolder(node)"></i>
          <span class="folder-name">{{ node.title }}</span>
<!--          <span class="folder-desc">created by {{ node?.origin?.author | lowercase }}</span>-->
        </span>
        <span *ngIf="node.isLeaf" (contextmenu)="contextMenu($event, menu, node)">
          <i nz-icon nzType="file"></i>
          <span class="file-name">{{ node.title }}</span>
<!--          <span class="file-desc">modified by {{ node?.origin?.author | lowercase }}</span>-->
        </span>
      </span>
</ng-template>
<nz-dropdown-menu #menu="nzDropdownMenu">
  <ul nz-menu >
    <li nz-menu-item (click)="selectDropdown(1)" *ngIf="activedNode?.origin.rank > 6">编辑</li>
    <li nz-menu-item (click)="deleteBuilding()" *ngIf="activedNode?.origin.rank > 6">删除</li>
    <li nz-menu-item (click)="selectDropdown(0)" *ngIf="activedNode?.origin.rank > 5 && activedNode?.origin.rank < 8 ">新增楼栋</li>
    <li nz-menu-item (click)="addBuildingBatch()" *ngIf="activedNode?.origin.rank > 5 && activedNode?.origin.rank < 8 ">批量新增楼栋</li>
    <li nz-menu-item (click)="selectDropdown(0)" *ngIf="activedNode?.origin.rank===8">新增单元</li>
  </ul>
</nz-dropdown-menu>
